package com.my.mvpframe.data.repository;

import com.my.mvpframe.bean.JokeBean;
import com.my.mvpframe.data.datasource.JokeDataSource;
import com.my.mvpframe.rxnet.HttpCenter;
import com.my.mvpframe.rxnet.RetrofitService;

import javax.inject.Inject;
import javax.inject.Singleton;

import io.reactivex.Flowable;

/**
 * Created by Tang on 2018/2/8
 */

@Singleton
public class JokeRespository implements JokeDataSource {
    private static final String BASE_URL = "http://v.juhe.cn/";//BASE_URL
    private final RetrofitService service;

    @Inject
    JokeRespository() {
        service = HttpCenter.getInstance().createService(BASE_URL, RetrofitService.class);
    }

    @Override
    public Flowable<JokeBean> getJokeData(String key, int page, int pagesize, String sort, String time) {
        return service.jokeData(key, page, pagesize, sort, time);
    }
}
